Release 10.1A: OpenEdge Data Management:
SQL Development
Using the SELECT statement
Use the
SELECTstatement to retrieve information from a database.The
SELECTstatement uses the following syntax:
The
SELECTstatement provides you with countless ways to retrieve and analyze the data in your database. Queries vary from simple to sophisticated. They can retrieve information from a single column of a single table, or they can retrieve data meeting specific conditions from many columns across many tables.The following statements offer just a few examples of how the
SELECTstatement can be used to create queries.In Example 6–1, the simple
SELECTstatement retrieves all columns from theCustomertable.
In Example 6–2, the statement is easily modified to identify columns from which the data will be retrieved.
The simple
SELECT-FROMcombination can even be used to retrieve a single set of results from multiple tables. Example 6–3 retrieves the customer and order information from both theCustomerandOrdertables.
The
WHEREclause can be used to further refine your query. In Example 6–4, theFROMclause uses theWHERE,GROUP BY,andHAVINGconditions to create a highly specific query statement. The query returns the customer number and number of orders for all customers who had more than 10 orders before March 31, 2003.
Notes: The
WHEREclause limits a query to retrieving specified rows based upon a search condition. TheGROUP BYclause produces a summary query in which similar rows are grouped together.TheHAVINGclause further restricts theGROUP BYclause by allowing only those groups that have been specified by a search condition.
OpenEdge SQL can access all databases objects created with Progress 4GL. The Progress 4GL can access SQL-created objects, but they must contain data types recognized by 4GL and must reside in the PUB schema of an OpenEdge RDBMS.
|
Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |